<template>
	<view class="work-container">
		<uni-fab ref="fab" horizontal="right" vertical="bottom"
			:popMenu="false" @fabClick="fabClick" />
		<uni-list>
			<uni-list-item v-for="item in list" :key="item.lngmainid" :title="item.strbilltemplatename" :note="formateNote(item)" :rightText="'单据号:'+item.strreceiptno" @click="handleClick(item)" link/>
		</uni-list>
	</view>
</template>

<script setup>
	import {
		listBusinessdata
	} from '@/api/business/businessdata.js'
	import {
		onShow
	} from "@dcloudio/uni-app"
	import {
		onMounted,
		ref
	} from "vue";
	const pageNum = ref(1);
	const pageSize = ref(20);
	const total = ref(0);
	const list = ref([])

	function getList() {
		const queryParams = {}
		queryParams.lngreceipttypeid = 112
		queryParams.blnisinactive = 0
		queryParams.pageNum = pageNum.value
		queryParams.pageSize = pageSize.value
		listBusinessdata(queryParams).then(res => {
			console.log(res)
			if (res.code === 200) {
				total.value = res.total
				list.value = res.rows
			}
		})
	}
	
	function formateNote(item){
		return `单据日期：${item.strdate}\n制单人：${item.strusername}\n单据状态：${item.strstatus}`
	}
	
	function fabClick(){
		console.log('add')
		uni.navigateTo({
			url: `/pages/work/detail?lngreceipttypeid=112`
		});
	}
	function handleClick(item){
		uni.navigateTo({
			url: `/pages/work/detail?lngreceipttypeid=112&lngmainid=${item.lngmainid}`
		});
	}
	onShow(()=>{
		getList()
	})
	onMounted(() => {
		
	})
</script>

<style lang="scss">
	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #fff;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}

	/* #endif */

	.text {
		text-align: center;
		font-size: 26rpx;
		margin-top: 10rpx;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 150px;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	@media screen and (min-width: 500px) {
		.uni-swiper-dot-box {
			width: 400px;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 8px;
		}

		.image {
			width: 100%;
		}
	}
</style>